home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Otherware
/
Otherware_1_SB_Development.iso
/
mac
/
sysext
/
init
/
bail.cpt
/
Bail ƒ
/
Bail Source
/
InitApplication Patch.c
next >
Wrap
Text File
|
1992-06-18
|
1KB
|
83 lines
// Patch for InitApplication to allow user to bail out
void main ( void ) ;
void CheckForBail ( void );
Boolean IsPressed(unsigned short k);
void main ( void )
{
long foo ;
asm {
movem.l d0-d7/a0-a4 , -(a7)
jmp @next
literal:
dc.w 0xeeee
dc.w 0xeeee
next:
move.l @literal , foo
}
CheckForBail ( ) ; // Well, do it !
asm {
movem.l (a7)+ , d0-d7/a0-a4
move.l foo , a0
unlk a6
jmp (a0)
}
}
void CheckForBail ( void )
/*
* Check to see if Command-. or the mouse button is down. If so, Bail!
* If the g key is down, break out of the timer loop and continue the launch.
*/
{
register long myTicks;
register long count;
register long base;
register long row;
register char *tmp;
base = ( long ) WMgrPort->portBits.baseAddr;
row = WMgrPort->portBits.rowBytes;
if ( row > 0 ) { //Draw the dots
tmp = ( char * ) base + row * 10 + 2;
*tmp |= 0x03;
}
myTicks = Ticks;
do
{
if(Button() || (IsPressed(0x2F) && IsPressed(0x37))){
ExitToShell(); //bail out
}
if(IsPressed(0x05)){
break; //Continue Immediately
}
}while ( Ticks < myTicks + 180 );
if ( row > 0 ) {
//Erase the dots
tmp = ( char * ) base + row * 10 + 2;
*tmp &= 0xfc;
}
}
Boolean IsPressed(unsigned short k)
/*
* Check to see if key number k is currently held down
*/
{
unsigned char km[16];
GetKeys(km); //Get the KeyMap
return((km[k>>3]>>(k&7))&1); //Check required bit
}